$(function() {
  //   console.log(111);
  let pageid = 1;
  function render() {
    $.ajax({
      url: 'http://localhost:3000/api/getmoneyctrl',
      data: { pageid },
      success(res) {
        console.log(res);
        $('.pro-list').html(template('proTmp', res));
      }
    });
  }
  render();

  //分页
  $('#selectPage').on('change', function() {
    console.log($('#selectPage').val());
    pageid = $('#selectPage').val();
    render();
  });
  //上一页
  $('.prev').on('click', () => {
    let id = pageid;
    id--;
    id = Math.max(id, 1);
    $('#selectPage').val(id);
    pageid = id;
    render();
  });
  //下一页
  $('.next').on('click', () => {
    let id = pageid;
    id++;
    id = Math.min(id, 3);
    $('#selectPage').val(id);
    pageid = id;
    render();
  });
});
